package com.harry.threaddemo;

/**
 * 实现 Runnable 接口类创建线程对象
 * 
 * @author Harry
 * @date 2018/3/22 10:43
 */
public class MyThreadBrother implements Runnable {
	@Override
	public void run() {
		System.out.println("MyThreadBrother 的线程对象正在执行任务");
	}

	public static void main(String[] args) {
		for (int i = 0; i < 10; i++) {
			Thread thread = new Thread(new MyThreadBrother());
			thread.start();

			System.out.println("MyThreadBrother 的线程对象 " + thread.getId());
		}

//		new Thread(new Runnable() {
//			@Override
//			public void run() {
//				System.out.println("MyThreadBrother 的线程对象正在执行任务");
//			}
//		}).start();


//		new Thread(() -> System.out.println("MyThreadBrother 的线程对象正在执行任务")).start();





	}
}
